/*
 * Xml.h
 *
 *  Created on: Jan 3, 2009
 *      Author: sez
 */

#ifndef XML_H_
#define XML_H_

#include <QStringList>

class QDomDocument;
class XmlPath;

class Xml
{
public:
    explicit Xml(const XmlPath &);
    virtual ~Xml();
    void appendTag(const QString &name, const QString &data);
    void appendArray(const QString &name, const QStringList &data);
    QString value(const QString &name) const;
    QStringList valueArray(const QString &) const;
    void serializeXml() const;
    void deserializeXml();
    QString getDataFileName() const;

private:
    QDomDocument *mDoc;
    XmlPath *mXmlPath;
};

template <typename T>
void appendTag(Xml &, const QString &, const T &);

template <typename T>
void appendArray(Xml &, const QString &, const QList<T> &);

template <typename T>
void appendTitleArray(Xml &, const QString &, const QList<T> &);

template <typename T>
T value(const Xml &, const QString &);

template <typename T>
QList<T> valueArray(const Xml &, const QString &);

template <typename T>
QList<T> valueTitleArray(const Xml &, const QString &);

#include "XmlImpl.cpp"

#endif /* XML_H_ */
